package com.example.vote.springboot_vote;

import com.spring4all.swagger.EnableSwagger2Doc;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.context.ApplicationContext;

import java.util.List;

//在应用主类中增加mapper的扫描包配置,这个是主java类的地址包路径，要写对，要么找不到
@MapperScan("com.example.vote.springboot_vote,com.example.vote.springboot_vote.mapper")
@EnableSwagger2Doc
@SpringBootApplication
public class SpringbootVoteApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringbootVoteApplication.class, args);


        //参数测试
        Book book =(Book) context.getBean("book");
        System.out.println(book.getAuthor());
        Binder binder = Binder.get(context.getEnvironment());
// 绑定List配置
        List<String> post = binder.bind("com.didispace.post", Bindable.listOf(String.class)).get();
        System.out.println(post);
    }

}
